package compareTest;

import epam_java.jsontest.UserTest;
import java.util.ArrayList;
import java.util.Comparator;

public class Compare {
    private ArrayList<UserTest> users;
    private ArrayList<Integer> userId;
    private ArrayList<Integer> logins;
 public  void  buildUsers(){
     users=new ArrayList<UserTest>();
        users.add(new UserTest(234,"aaa","login", "password", "admin"));
        users.add(new UserTest(236,"bbb","login", "password", "admin"));
        users.add(new UserTest(236,"ddd","login", "password", "admin"));
        users.add(new UserTest(237,"ccc","login", "password", "admin"));
        users.add(new UserTest(234,"aaa","login", "password", "admin"));

        users.add(new UserTest(234,"aaa","login", "password", "admin"));

        users.add(new UserTest(234,"aaa","login", "password", "admin"));

        users.add(new UserTest(234,"aaa","login", "password", "admin"));
    }
public int getCountequalsUser(){
    int c1=0;
    int c=0;
     for(int i=0;i<users.size();i++){
         for(int k=i+1;k<users.size();k++){
             if(users.get(i).equals(users.get(k))) c++;
         }
         if(c>c1) c1=c;
           c=0;
     }
     return c1+1;
 }
 public  void buildUserId(){
        setUserId(new ArrayList<Integer>(getUsers().size()));
       for(int i=0;i<getUsers().size();i++){
            getUserId().add(i);
       }
   }
  public void buildLogins(){
        setLogins(new ArrayList<Integer>(getUsers().size()));
        for(int i=0;i<getUsers().size();i++){
            getLogins().add(i);
       }
   }

    /**
     * @return the users
     */
    public ArrayList<UserTest> getUsers() {
        return users;
    }

    /**
     * @param users the users to set
     */
    public void setUsers(ArrayList<UserTest> users) {
        this.users = users;
    }

    /**
     * @return the userId
     */
    public ArrayList<Integer> getUserId() {
        return userId;
    }

    /**
     * @param userId the userId to set
     */
    public void setUserId(ArrayList<Integer> userId) {
        this.userId = userId;
    }

    /**
     * @return the logins
     */
    public ArrayList<Integer> getLogins() {
        return logins;
    }

    /**
     * @param logins the logins to set
     */
    public void setLogins(ArrayList<Integer> logins) {
        this.logins = logins;
    }
}

